﻿package net.wangit.demo.performance;

import net.wangit.Unit;
import net.wangit.context.ActionContext;
import net.wangit.support.UnitInterceptor;

public class TreePerformanceUI implements UnitInterceptor {

  public String intercept(ActionContext ac, Unit unit) throws Exception {
    int level = ac.getRequestParameterInt("performance.tree.level",
        PerformanceTreeFactory.LEVEL);
    int size = ac.getRequestParameterInt("performance.tree.size",
        PerformanceTreeFactory.SIZE);
    unit.getElement("level").setDefaultValue(Integer.toString(level));
    unit.getElement("size").setDefaultValue(Integer.toString(size));
    return unit.write(ac);
  }

}
